class IpemsController < ApplicationController
  # GET /ipems
  # GET /ipems.xml
  def index
    @ipems = Ipem.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @ipems }
    end
  end

  # GET /ipems/1
  # GET /ipems/1.xml
  def show
    @ipem = Ipem.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @ipem }
    end
  end

  # GET /ipems/new
  # GET /ipems/new.xml
  def new
    @ipem = Ipem.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @ipem }
    end
  end

  # GET /ipems/1/edit
  def edit
    @ipem = Ipem.find(params[:id])
  end

  # POST /ipems
  # POST /ipems.xml
  def create
    @ipem = Ipem.new(params[:ipem])

    respond_to do |format|
      if @ipem.save
        flash[:notice] = 'Ipem was successfully created.'
        format.html { redirect_to(@ipem) }
        format.xml  { render :xml => @ipem, :status => :created, :location => @ipem }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @ipem.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /ipems/1
  # PUT /ipems/1.xml
  def update
    @ipem = Ipem.find(params[:id])

    respond_to do |format|
      if @ipem.update_attributes(params[:ipem])
        flash[:notice] = 'Ipem editado com sucesso.'
        format.html { redirect_to(@ipem) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @ipem.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /ipems/1
  # DELETE /ipems/1.xml
  def destroy
    @ipem = Ipem.find(params[:id])
    @ipem.destroy

    respond_to do |format|
      format.html { redirect_to(ipems_url) }
      format.xml  { head :ok }
    end
  end
end
